package com.jamal2362.apktool.preference;

import android.content.Context;
import android.preference.EditTextPreference;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.widget.TextView;
import com.jamal2362.apktool.util.Settings;
import com.jamal2362.apktool.util.TextUtil;

class EditTextPreferences extends EditTextPreference
{
    public EditTextPreferences(Context ctx, AttributeSet attrs, int defStyle)
    {
        super(ctx, attrs, defStyle);        
    }

    public EditTextPreferences(Context ctx, AttributeSet attrs)
    {
        super(ctx, attrs);  
    }

	public EditTextPreferences(Context context)
	{
		this(context, null, 0);
	}

    @Override
    protected void onBindView(View view)
    {       
        super.onBindView(view);
		TextView title = view.findViewById(android.R.id.title);
		if (title != null)
		{
			TextUtil.setTextAppearance(view.getContext(), title, android.R.style.TextAppearance_Medium);
			title.setSingleLine(false);
			title.setTextSize(TypedValue.COMPLEX_UNIT_SP, Settings.appFontSize);
		}
        TextView summary= view.findViewById(android.R.id.summary);
        if (summary != null)
		{
			TextUtil.setTextAppearance(view.getContext(), summary, android.R.style.TextAppearance_Small);
			summary.setSingleLine(false);
			summary.setTextSize(TypedValue.COMPLEX_UNIT_SP, Settings.appFontSize - 4);
		}
    }       
}
